package cn.edu.scau.cmi.wuzhenzhou.client;

import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;

public class ComprehensiveExperimentClient extends Application{

	public static void main(String[] args) {
		launch(args);
	}
	
	@Override
	public void start(Stage primaryStage) throws Exception {
		Pane pane = new Pane();
			
		Image image = new Image("file:image/root.jpg");
		ImageView imageView = new ImageView(image);
		
		Label id = new Label("学号： \t 201716100325");
		Label name = new Label("姓名： \t 吴镇州");
		
		Button b1 = new Button("实验1：接口编程");
		Button b2 = new Button("实验2：单例模式和多例模式");
		Button b3 = new Button("实验3：简单工厂方法模式");
		Button b4 = new Button("实验3：工厂模式");
		Button b5 = new Button("实验3：抽象工厂模式");
		Button b6 = new Button("实验4：一致性组合模式");
		Button b7 = new Button("实验4：安全型组合模式");
		Button b8 = new Button("实验5：适配器模式");
		Button b9 = new Button("实验6、7：orm + mybatis+spring");

		
		
		id.setLayoutX(20);
		id.setLayoutY(435);
		
		name.setLayoutX(20);
		name.setLayoutY(455);
		
		b1.setLayoutX(450);
		b1.setLayoutY(20);
		
		b2.setLayoutX(450);
		b2.setLayoutY(50);
		
		b3.setLayoutX(450);
		b3.setLayoutY(80);
		
		b4.setLayoutX(450);
		b4.setLayoutY(110);
		
		b5.setLayoutX(450);
		b5.setLayoutY(140);
		
		b6.setLayoutX(450);
		b6.setLayoutY(170);
		
		b7.setLayoutX(450);
		b7.setLayoutY(200);
		
		b8.setLayoutX(450);
		b8.setLayoutY(230);
		
		b9.setLayoutX(450);
		b9.setLayoutY(260);
		
		
		b1.setOnMouseClicked(new EventHandler<MouseEvent>() {
			@Override
			public void handle(MouseEvent event) {
				InterProgrammingClient interProgrammingClient = new InterProgrammingClient();
				interProgrammingClient.start();
			}
		});
		
		b2.setOnMouseClicked(new EventHandler<MouseEvent>() {
			@Override
			public void handle(MouseEvent event) {
				SingletonClient singletonClient = new SingletonClient();
				try {
					singletonClient.start(new Stage());
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		});
		
		b3.setOnMouseClicked(new EventHandler<MouseEvent>() {
			@Override
			public void handle(MouseEvent event) {
				SimpleFactoryMethodClient sc = new SimpleFactoryMethodClient();
				try {
					sc.start(new Stage());
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		});
		
		b4.setOnMouseClicked(new EventHandler<MouseEvent>() {
			@Override
			public void handle(MouseEvent event) {
				FactoryClinet fc = new FactoryClinet();
				try {
					fc.start(new Stage());
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		});
		
		b5.setOnMouseClicked(new EventHandler<MouseEvent>() {
			@Override
			public void handle(MouseEvent event) {
				AbstractFactoryClient ac = new AbstractFactoryClient();
				try {
					ac.start(new Stage());
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		});
		
		b6.setOnMouseClicked(new EventHandler<MouseEvent>() {
			@Override
			public void handle(MouseEvent event) {
				SafeCompositeClient sc = new SafeCompositeClient();
				sc.start();
			}
		});
		
		b7.setOnMouseClicked(new EventHandler<MouseEvent>() {
			@Override
			public void handle(MouseEvent event) {
				ConsistentCompositeClient consistentCompositeClient = new ConsistentCompositeClient();
				consistentCompositeClient.start();
			}
		});
		
		b8.setOnMouseClicked(new EventHandler<MouseEvent>() {
			@Override
			public void handle(MouseEvent event) {
				AdapterClient adc = new AdapterClient();
				try {
					adc.start(new Stage());
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		});
		
		b9.setOnMouseClicked(new EventHandler<MouseEvent>() {
			@Override
			public void handle(MouseEvent event) {
				ComprehensionClient cc = new ComprehensionClient();
				try {
					cc.start();
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		});
		
		
		pane.getChildren().addAll(imageView, b1, b2, b3, b4, b5, b6, b7, b8, b9, id, name);
		primaryStage.setScene(new Scene(pane, 700, 500));
		primaryStage.show();
	}
	
	
	

}
